package top.huiger.newday.base

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import top.huiger.newday.widget.swipeback.SwipeBackFragment

/**
 *
 * Created by <huiGer> on 2018/1/8
 */
abstract class BaseFragment : SwipeBackFragment() {

    override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        var rootView = inflater?.inflate(setViewId(), container, false)
        return attachToSwipeBack(rootView)
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        initV()
        initEvent()
        loadData()
    }

    protected abstract fun setViewId(): Int
    protected abstract fun initV()
    protected abstract fun initEvent()
    protected abstract fun loadData()
}